package com.ashin.controller;

import com.ashin.bean.Student;
import com.ashin.repository.StudentRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@Slf4j
public class HelloRedisController {


    @Autowired
    private RedisTemplate redisTemplate;

    @RequestMapping("/redis")
    public String redis() {
        redisTemplate.opsForValue().set("demo", "spring redis");
        Object demo = redisTemplate.opsForValue().get("demo");
        log.info("demo value:{}", demo);

        return "redis";
    }


    @RequestMapping("/sub/{channelName}")
    public String sub(@PathVariable String channelName) {

        return "redis";
    }


}
